
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../style/default/jsvm.css"/>
<link rel="stylesheet" type="text/css" href="../../style/default/dashboard.css"/>
<script id="j$vm" src="../../jsvm/jsre.js" ></script>
<script src="../../jsvm/lib/jsre-ui.js" ></script>

<style>

.bt_0, .bt_1{
   width: 60px;
   height: 30px;
   background-color: #FFFFFF;
   border: 1px solid blue;
}


</style>
</head>

<body></body>

<script type="text/javascript">


J$VM.exec(
    "Demo",
    function(System){

        this.prefer({theme: "default"});
        var start = new Date();

        var treeDef = {
            id: "root1",
            nodes:[
                { name:"aaa", nodes:[{nodes:[{ nodes:[{nodes:[{ nodes:[{nodes:[{ nodes:[{markable:true},{}]},{}, {nodes:[{},{}]}]},{}]},{}, {nodes:[{},{}]}]},{}]},{}, {nodes:[{markable:true},{markable:true}]}]},{markable:true}]},
                { name:"bbb", nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
                { name: "ccc",nodes:[{text:"Node111111111111111111"},{name: "bvnode",type:"bv", iname:"test"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{name: "bvnode",type:"bv", iname:"test2"}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]},
               { nodes:[{ nodes:[{},{}]},{}, {nodes:[{},{}]}]}
            ],
            resizable: true,
            movable: true,
            shadow: true,
            width: 200, height: 400
        };

        var dataProvider = new js.awt.AbstractTreeDataProvider(this);
        dataProvider.getIconImage = function(){
            return "folder.gif";
        };
        dataProvider.canDrag = function(){
            return true;
        };


        this.addComponent(new js.awt.Tree(treeDef, this, dataProvider));
        this.root1.setPeerComponent(this);
        System.err.println("Cost: "+(new Date()-start));

        var _onTreeItemEvent = function(e){
            var target = e.getEventTarget();
            if(target instanceof js.awt.TreeItem){
                System.err.println(target.getText() +" "+e.getType());
            }else{
                System.err.println(e.getType());
            }
            
        };

        J$VM.MQ.register("js.awt.event.TreeItemEvent", this, _onTreeItemEvent);

        this.root1.expandAll(true);


        var ret = this.root1.getNodes(
            function(itemDef){
                return (itemDef.type == "bv"); 
            }, true);
        for(var i=0; i<ret.length; i++){
            ret[i].setEnabled(false);
            ret[i].showDisableCover.$delay(ret[i], 1, true);            
            System.err.println(JSON.stringify(ret[i].def.iname)+" "+ret[i].isEnabled());
        }
        

        //this.root1.expandAll.$delay(this.root1, 5000, false);
    });

</script>

</html>
